export PATH=`pwd`/cicd/rn:$PATH
source check_env.sh

function prepare() {

	check_files
	
	# ===================================================================================================================
	prepare_rnoh_prebuild

	# ===================================================================================================================
	prepare_project $1
	if [ $? -ne 0 ]; then
        echo "Failed to execute prepare_project()!!!"
	#return 1
        return 0
    fi

	# ===================================================================================================================
	prepare_tools
	if [ $? -ne 0 ]; then
	    rm -rf "$TOOLS_DIR"/
        echo "Failed to execute prepare_tools()!!!"
	#return 1
        return 0
    fi

	# ===================================================================================================================
    # 测试，看有没有GLIBC版本报错
    export PATH="$TOOLS_DIR"/bin:"$TOOLS_DIR"/tool/node/bin:$PATH
    echo "开始检测Node版本!!!"
	echo "环境变量：$PATH"
	node -v
    npm -v
	
	# ===================================================================================================================
	prepare_config_files
	if [ $? -ne 0 ]; then
        echo "Failed to execute prepare_config_files()!!!"
	#return 1
        return 0
    fi

	# ===================================================================================================================

    echo "prepare build successfully!!!"
	
    return 0
}

prepare $@
exit $?